/*
 * ServerStatus.java
 *
 * Created on January 27, 2007, 3:55 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package net.sf.iSnake.server;

import java.awt.Dimension;
import java.util.Calendar;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

/**
 *
 * @author Suraj
 */
public class ServerStatus extends JFrame{
    public static final short DEBUG_ERROR       =1;
    public static final short DEBUG_MESSAGE     =2;
    public static final short DEBUG_WARNING     =3;
    public static final short DEBUG_INFO        =4;
    JTextArea statusBox=new JTextArea();
    /** Creates a new instance of ServerStatus */
    public ServerStatus() {
        JScrollPane textScroll=new JScrollPane(statusBox);
        this.add(textScroll);
        statusBox.setMinimumSize(new Dimension(300,200));
        statusBox.setEditable(false);
        statusBox.setTabSize(9);
        this.setTitle("Status Box :)");
        this.setSize(new Dimension(500,400));
        this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
        this.setResizable(true);
    }
    /**Displays the Message wrt the Status code
     */
    public void status(short status,String message){
        if(status==this.DEBUG_ERROR){
            statusBox.append("\n"+Calendar.getInstance().getTime().toString()+" : "+message);
        } else if(status==this.DEBUG_MESSAGE){
            statusBox.append("\n"+Calendar.getInstance().getTime().toString()+" : "+message);
        } else if(status==this.DEBUG_WARNING){
            statusBox.append("\n"+Calendar.getInstance().getTime().toString()+" : "+message);
        } else if(status==this.DEBUG_INFO){
            statusBox.append("\n"+Calendar.getInstance().getTime().toString()+" : "+message);
        }
        //statusBox.updateUI();
    }
}
